package com.zwb.service.common.utils;

import com.zwb.service.pojo.Admin;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.UserDetails;

/**
 * @author 头发又黑又长
 * @Date 2022/9/6 19:20
 * @email zwb15083976291@163.com
 */
public class AdminUtil {

    /**
     * 获取当前 security 登录对象
     *
     * @return
     */
    public static UserDetails getCurrentAdmin() {
        return (UserDetails) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
    }

}
